package name.fowler.refactoring.simplestore;

class XMLFormatter implements Formatter {
	@Override
		public void header(String text) {
		System.out.print("<?xml version='1.0'?>\n<report>");
		if (text != null) {
			System.out.print(String.format("\n  <head>%s</head>", text));
		}
		System.out.println("\n  <body>");
	}

	@Override
		public void println( String text ) {
		System.out.println("    <p>" + text + "</p>");
	}

	@Override
		public void footer(String text) {
		System.out.println("  </body>");
		if (text != null) {
			System.out.println(String.format("  <foot>%s</foot>", text));
		}
		System.out.println("</report>");
	}
}
